package util;

import android.graphics.Point;

public class PointUtil {
	
	public static Point getVectorCoordinate(Point p1, Point p2){
		Point pointResult = new Point();
		pointResult.x = p1.x - p2.x;
		pointResult.y = p1.y - p2.y;
		return pointResult;
	}
	
	public static double getVectorLenght(Point p1) {
		return Math.sqrt((double)p1.x * p1.x + p1.y * p1.y);
	}
	
	public static double getScalar(Point p1, Point p2){
		return (double)p1.x * p2.x + p1.y * p2.y;
	}
	
	public static double getAngle (Point p1, Point p2){
		double scalar = getScalar(p1, p2)/ (getVectorLenght(p1) * getVectorLenght(p2));
		return Math.acos(scalar) * 180 / Math.PI;
	}
	

}
